Repository navigation
fix(audit): make the release-boundary check reproducible and stop it failing on its own fixture - #3
Merged
Conversation
…failing on its own fixture `tools/machine_semantic_audit.py` reported FAIL with 18 findings on a clean clone, and the committed receipt claimed PASS with 0 findings over 52 files while the tree holds 218. Three defects, each verified by measurement before the fix. 1. The audit flagged its own rights-cleared fixture. The 18 PNGs under `experiments/six_arm/dataset/images/` are synthetic and are not source-derived: all are 96x96 RGB with IDAT 27760 of 27648 raw bytes (compression ratio 0.996) and 9210-9215 distinct colours per 9216 pixels. That is incompressible noise; a page or figure crop compresses 5-50x and reuses colours heavily. Each file is content-bound by sha256 and byte size in `dataset/dataset_manifest.json` (all 18 verified, 0 mismatches), and that manifest declares the set a rights-cleared synthetic contract fixture, so untracking the images would break the fixture rather than improve the boundary. They are allow-listed instead, individually rather than by directory, so an unexpected 19th image in that directory still raises `unexpected_media`. 2. The receipt was hashed into its own digest, so it could never be accurate. Writing the receipt changed the digest it records; iterating write/audit four times produced four different digests and never converged. A committed receipt is therefore unsatisfiable by construction, which is why the stale one survived unnoticed. The receipt is now excluded from the digest input only. It is still scanned for forbidden strings and secrets like any other text file -- excluding it from scanning as well was tried first and rejected by mutation test (a forbidden token placed inside the receipt stopped being flagged). 3. A directory exclusion containing a separator could never match. The exclusion set is compared against `p.parts`, whose components never contain a slash, so the literal `"src/ecm_tqag.egg-info"` excluded nothing. After `pip install -e .` the egg-info files entered the digest: measured `2d0ac94d...` (218 files) clean versus `60140bec...` (224 files) built. A reviewer following README section 7 after installing the package computed a different digest from the committed receipt, so the receipt was irreproducible. Exclusions now match per path component via `EXCLUDED_PARTS`. The receipt is regenerated and now reproduces exactly, including after an editable install. Mutation-verified, because a check never observed red is not evidence: | mutation | expected | observed | | --- | --- | --- | | add a 19th undeclared PNG | FAIL | exit 1, `unexpected_media` on that file | | forbidden token in a new .md | FAIL | exit 1, `forbidden_baseline` | | forbidden token inside the receipt | FAIL | exit 1, flagged against the receipt | | create `src/ecm_tqag.egg-info/` (6 files) | digest unchanged | digest unchanged, 218 files | | create `.pytest_cache/junk.txt` | digest unchanged | digest unchanged | | remove every mutation | PASS | exit 0, 0 findings | CI steps reproduced in a fresh venv: `pytest` exit 0 (35 passed, 2 skipped); `ecm-tqag validate fixtures/packages` exit 0; audit exit 0, PASS, 0 findings. Not changed: `semantic_validation` stays `false`, and the audit still checks strings and file classes only. A PASS here means no unexpected media and no forbidden string was found, not that any semantic or rights claim was validated.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
tools/machine_semantic_audit.pyreported FAIL with 18 findings on a cleanclone, while the committed receipt
machine-policy-audit.jsonclaimed PASS,0 findings, 52 files — against a tree that actually holds 218 files. Both
sides were wrong. Three defects, each verified by measurement before the fix.
This is the follow-up I flagged in PR #1 and PR #2 rather than mixing into them.
Neither earlier PR changed the finding count (measured 18 → 18), so the defect
predates both.
1. The audit flagged its own rights-cleared fixture
The 18 PNGs under
experiments/six_arm/dataset/images/are synthetic and arenot source-derived. Measured, not inferred from the filename:
Incompressible noise with nearly every pixel a unique colour is generated
pixels, not a scan.
dataset/dataset_manifest.jsonadditionally binds all 18 bysha256 and byte size (0 mismatches) and declares the set "Rights-cleared
synthetic contract fixture; not the empirical study corpus."
So untracking was the wrong fix: removing the images would break a
content-bound fixture. They are allow-listed instead — individually, not by
directory, so an unexpected 19th image there still raises
unexpected_media.The rationale and the measurements are recorded in a comment at the allow-list
so the next reader does not have to redo this.
2. The receipt was hashed into its own digest, so it could never be accurate
Writing the receipt changed the digest it records. Iterating write → audit four
times produced four different digests and never converged:
A committed receipt is therefore unsatisfiable by construction — which is
exactly why the stale one survived unnoticed. The receipt is now excluded from
the digest input only.
It is still scanned. Excluding it from scanning as well was my first attempt
and a mutation test rejected it: a forbidden token placed inside the receipt
stopped being flagged. The exclusion is scoped to the digest, and the mutation
table below pins that.
3. A directory exclusion containing a separator could never match
The exclusion set is compared against
p.parts, whose components never containa slash — so the literal
"src/ecm_tqag.egg-info"excluded nothing. Afterpip install -e .the egg-info files entered the digest:A reviewer following README §7 after installing the package computed a
different digest from the committed receipt, so the receipt was
irreproducible — and README §7 explicitly tells them to regenerate it.
Exclusions now match per path component via
EXCLUDED_PARTS, and the digest isstable under build artifacts (measured: 218 files both ways).
Verification
Every claim above was measured on this tree before committing.
Mutation-verified, because a check never observed red is not evidence:
unexpected_mediaon that file.mdforbidden_baselinesrc/ecm_tqag.egg-info/(6 files).pytest_cache/junk.txtCI steps reproduced locally in a fresh venv, matching
.github/workflows/ci.yml:pytest→ exit 0 (35 passed, 2 skipped);ecm-tqag validate fixtures/packages→ exit 0; audit → exit 0, PASS, 0 findings over 218 files.
The receipt is regenerated and reproduces exactly, including after an editable
install — which is the specific failure being fixed.
Not changed
semantic_validationstaysfalse, and the audit still checks strings and fileclasses only. A PASS here means no unexpected media and no forbidden string was
found — not that any semantic or rights claim was validated. The tool's own
docstring says so and that boundary is unchanged.